package linc.cool.pubsub;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import linc.cool.utils.RabbitConstant;
import linc.cool.utils.RabbitUtils;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.util.Scanner;
import java.util.concurrent.TimeoutException;

/**
 * @author yqlin
 * @date 2022/3/3 4:38 下午
 * @description 发布者 天气预报
 */
@Slf4j
public class WeatherBureauProducer {
    public static void main(String[] args) throws IOException, TimeoutException {
        Connection connection = RabbitUtils.getConnection();
        Channel channel = connection.createChannel();
        String input = new Scanner(System.in).next();
        channel.basicPublish(RabbitConstant.EXCHANGE_WEATHER, "", null, input.getBytes());
        channel.close();
        connection.close();
    }
}
